--[[/**
-- * 
 * 改变能量，溢出则增加buff
 *
 * @author heyang
-- *
-- */]]

---@class BuffEffect546100 : BaseBuffEffect
BuffEffect546100 = ClientFight.CreateClass("BuffEffect546100", ClientFight.BaseBuffEffect)
local t = BuffEffect546100
t.BUFF_EFFECT_546100_HP = "BUFF_EFFECT_546100_HP";
---@param fight Fight
---@param buff FighterBuff
function t:action(fight, buff, ...)
    local parameters = {...};
    local target = buff.target;
    local effectVals = buff.buffBean.f_BuffEffectValue;
    local addHp = parameters[1];
    if (addHp <= 0) then
        return IBuffEffect.FAIL;
    end

    local save = target.parametersByObject[t.BUFF_EFFECT_546100_HP] or 0;
    local addSave = Utils.calcRatio(addHp, effectVals[1]);
    local maxLimit = Utils.calcRatio(FighterAttributeManager.getFightAttr(target, FighterAttributeEnum.HP), effectVals[2]);
    save = save + addSave;
    if (save >= maxLimit) then
        save = maxLimit;
    end
    local logSave = save;
    SkillRoleMgr.savePathFile(string.format("[%s][EFFECT]Fighter %s  Buff%s 当前储存治疗量%s",
            fight.frame, buff.target.fighterId, buff.modelId, logSave));
    target.parametersByObject[t.BUFF_EFFECT_546100_HP] = save;
    return ClientFight.BaseBuffEffect.action(self, fight, buff, ...);
end

t.New()